package com.suoluo.zenadmin.controllers.admin.bigimage;

import javax.annotation.Resource;

import net.paoding.rose.web.Invocation;
import net.paoding.rose.web.annotation.Param;
import net.paoding.rose.web.annotation.Path;
import net.paoding.rose.web.annotation.rest.Get;
import net.paoding.rose.web.annotation.rest.Post;

import com.suoluo.zenadmin.common.CommonResp;
import com.suoluo.zenadmin.controllers.JSONInterceptor.JSON;
import com.suoluo.zenadmin.service.bigimage.BigImageService;
import com.suoluo.zenadmin.vo.bigimage.BigImageVO;

@Path("/")
public class BigImageController {

	@Resource(name="bigImageService")
	private BigImageService bigImageService;
	
	@Get("vlist")
	public String toListBigImages()
	{
		return "listBigImage";
	}
	@JSON
	@Post("list")
	public Object listBigImage()
	{
		return bigImageService.findListBigImage();
	}
	@Get("vsave")
	public String toAddBigImage()
	{
		return "addHomeAndHotelBigImage";
	}
	@JSON
	@Post("save")
	public Object saveBigImage(BigImageVO image)
	{
		bigImageService.saveBigImage(image);
		return CommonResp.SUCCESS;
	}
	@Get("vupdate")
	public String toUpdateBigImage(Invocation invo,@Param("imageId")int imageId)
	{
		BigImageVO imageVO = bigImageService.findBigImageById(imageId);
		invo.addModel("bigImageInfo",imageVO);
		return "updateHomeAndHotelBigImage";
	}
	@JSON
	@Post("update")
	public Object updateBigImage(BigImageVO imageVO)
	{
		bigImageService.updateBigImage(imageVO);
		return CommonResp.SUCCESS;
	}
	@JSON
	@Post("delete")
	public Object deleteBigImage(BigImageVO imagePOJO)
	{
		bigImageService.deleteBigImage(imagePOJO);
		return CommonResp.SUCCESS;
	}
}
